import {
    ACTION_SET_FROM,
    ACTION_SET_TO,
    ACTION_SET_ISCITY_SELECT_VISIBLE,
    ACTION_SET_CURRENT_SELECT_LEFT_CITY,
    ACTION_SET_CITYDATA,
    ACTION_SET_DEPARTDATE,
    ACTION_SET_ISLOADING_CITY_DATA,
    ACTION_SET_ISDATE_SELECT_VISIBLE,
    ACTION_SET_HIGHSPEED,
} from './actions';
export default {
    from(prevState = '北京', action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_FROM:
                return payload;
            default:
                break;
        }
        return prevState;
    },
    to(prevState = '上海', action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_TO:
                return payload;
            default:
                break;
        }
        return prevState;
    },
    //城市选择浮层是否可见
    isCitySelectVisible(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ISCITY_SELECT_VISIBLE:
                return payload;

            default:
                break;
        }
        return prevState;
    },
    //设置左边还是右边的城市
    currentSelectLeftCity(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_CURRENT_SELECT_LEFT_CITY:
                return payload;
            default:
                break;
        }
        return prevState;
    },
    //异步加载的城市列表数据
    cityData(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_CITYDATA:
                return payload;

            default:
                break;
        }
        return prevState;
    },
    isLoadingCityData(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ISLOADING_CITY_DATA:
                return payload;
            default:
                break;
        }
        return prevState;
    },
    //是否显示 日期选择浮层
    isDateSelectVisible(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ISDATE_SELECT_VISIBLE:
                return payload;

            default:
                break;
        }
        return prevState;
    },
    //是否选择高铁动车
    highSpeed(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_HIGHSPEED:
                return payload;
            default:
                break;
        }
        return prevState;
    },

    departDate(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTDATE:
                return payload;
            default:
                break;
        }
        return prevState;
    },
};
